package com.huqing.icu.dao;

import com.huqing.icu.mapper.HouseInteractionPanelMapper;
import com.huqing.icu.model.HouseInteractionPanel;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description 房源互动面板dao
 * @Author huqing
 * @Date 2025/9/13 19:14
 **/
@Repository
public class HouseInteractionPanelDao {

    @Resource
    private HouseInteractionPanelMapper houseInteractionPanelMapper;

    public void init(Long houseId) {
        HouseInteractionPanel houseInteractionPanel = new HouseInteractionPanel();
        houseInteractionPanel.setHouseId(houseId);
        houseInteractionPanel.setActualViewCount(0);
        houseInteractionPanel.setActualViewUserCount(0);
        houseInteractionPanel.setActualLikeCount(0);
        houseInteractionPanel.setActualFavoriteCount(0);
        houseInteractionPanel.setActualCommentCount(0);
        houseInteractionPanelMapper.insert(houseInteractionPanel);
    }

    public HouseInteractionPanel selectByHouseId(Long houseId) {
        return houseInteractionPanelMapper.selectByHouseId(houseId);
    }

    public List<HouseInteractionPanel> selectByHouseIdList(List<Long> houseIdList) {
        return houseInteractionPanelMapper.selectByHouseIdList(houseIdList);
    }
    public Integer incrActualViewCount(Long id) {
       return houseInteractionPanelMapper.incrActualViewCount(id);
    }

    public Integer incrActualViewUserCount(Long id) {
        return houseInteractionPanelMapper.incrActualViewUserCount(id);
    }

    public Integer decrActualViewUserCount(Long id) {
        return houseInteractionPanelMapper.decrActualViewUserCount(id);
    }

    public Integer incrActualClickCount(Long id) {
        return houseInteractionPanelMapper.incrActualClickCount(id);
    }

    public Integer decrActualClickCount(Long id) {
        return houseInteractionPanelMapper.decrActualClickCount(id);
    }

    public Integer incrActualLikeCount(Long id) {
        return houseInteractionPanelMapper.incrActualLikeCount(id);
    }

    public Integer decrActualLikeCount(Long id) {
        return houseInteractionPanelMapper.decrActualLikeCount(id);
    }

    public Integer incrActualFavoriteCount(Long houseId) {
        return houseInteractionPanelMapper.incrActualFavoriteCount(houseId);
    }

    public Integer decrActualFavoriteCount(Long houseId) {
        return houseInteractionPanelMapper.decrActualFavoriteCount(houseId);
    }


    public Integer incrActualCommentCount(Long id) {
        return houseInteractionPanelMapper.incrActualCommentCount(id);
    }

    public Integer decrActualCommentCount(Long id, Integer count) {
        return houseInteractionPanelMapper.decrActualCommentCount(id, count);
    }
}
